<?php

namespace App\Http\Middleware;

use Closure;
use Illuminate\Support\Facades\Input;
use Illuminate\Support\Facades\Redis;

class WechatAuth
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
        $session_3rd = Input::get('_3rd_session');
        if(!Redis::exists($session_3rd)) {
            return response()->json([
                'code' => 0,
                'msg' => '不存在3rd_session'
            ]);
        }

        return $next($request);
    }
}
